{% extends "base.html" %}

{% block content %}

{% if type == 'urls_top' %}
    <h4>访问数 Top N 的URL</h4>
    <table class="table table-striped table-bordered">
        <tr>
            <th>URL</th>
            <th>访问数</th>
        </tr>
        {% for query in queryset %}
            <tr>
                <td>{{ query.request_url }}</td>
                <td>{{ query.counts }}</td>
            </tr>
        {% endfor %}
    </table>

{% elif type == 'ips_top' %}
    <h4>访问数 Top N 的用户IP</h4>
    <table class="table table-striped table-bordered">
        <tr>
            <th>用户IP</th>
            <th>访问数</th>
        </tr>
        {% for query in queryset %}
            <tr>
                <td>{{ query.user_ip }}</td>
                <td>{{ query.counts }}</td>
            </tr>
        {% endfor %}
    </table>

{% elif type == 'os_percent' %}
    <h4>Android和iOS客户端访问数占比</h4>
    <table class="table table-striped table-bordered">
        <tr>
            <th>操作系统</th>
            <th>访问数</th>
            <th>访问占比</th>
        </tr>
        {% for query in queryset %}
            <tr>
                <td>{{ query.user_os }}</td>
                <td>{{ query.counts }}</td>
                <td>{{ query.percent }}</td>
            </tr>
        {% endfor %}
    </table>

{% elif type == 'version_percent' %}
    <h4>Android和iOS客户端各版本访问数占比</h4>
    <table class="table table-striped table-bordered">
        <tr>
            <th>操作系统</th>
            <th>APP版本号</th>
            <th>访问数</th>
            <th>访问占比</th>
        </tr>
        {% for query in queryset %}
            <tr>
                <td>{{ query.user_os }}</td>
                <td>{{ query.app_version }}</td>
                <td>{{ query.counts }}</td>
                <td>{{ query.percent }}</td>
            </tr>
        {% endfor %}
    </table>

{% elif type == 'response_avg' %}
    <h4>各状态码对应的平均响应时间</h4>
    <table class="table table-striped table-bordered">
        <tr>
            <th>响应状态码</th>
            <th>平均响应时间</th>
        </tr>
        {% for query in queryset %}
            <tr>
                <td>{{ query.status_code }}</td>
                <td>{{ query.avg }}</td>
            </tr>
        {% endfor %}
    </table>

{% endif %}

{% endblock %}